package com.example.adouble.cehuamenu.ui.activity;

import android.content.Intent;
import android.content.res.Resources;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import android.widget.Toast;

import com.example.adouble.cehuamenu.R;
import com.example.adouble.cehuamenu.util.ImageFilter;

/**
 * 图书详情
 */

public class DetailActivity extends AppCompatActivity {

    private TextView bkname;
    private ImageButton bkcollect;
    private TextView bkread;
    private ImageView bkimg;
    private TextView bkintroduce;

    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.activity_detail);

        initView();
        Intent intent = getIntent();
        String bname = intent.getStringExtra("bname");
        bkname.setText(bname);

//        collect.setOnClickListener(new View.OnClickListener() {
//            @Override
//            public void onClick(View view) {
//                Toast.makeText(DetailActivity.this,"点击了",Toast.LENGTH_SHORT).show();
//            }
//        });


        //模糊
        Resources res = DetailActivity.this.getResources();
        //拿到初始图
        Bitmap bmp= BitmapFactory.decodeResource(res, R.drawable.timg);
        //处理得到模糊效果的图
        Bitmap blurBitmap = ImageFilter.blurBitmap(this, bmp, 20f);
        bkimg.setImageBitmap(blurBitmap);

    }

    public void initView(){

        bkname = findViewById(R.id.tvBookName);
//        tv_read = findViewById(R.id.tv_read);
//        tv_introduce = findViewById(R.id.tv_introduce);
//        collect = findViewById(R.id.collect);
        bkimg = findViewById(R.id.imgBookCover);

    }
}
